Advanced Movement Command Information
-------------------------------------

-= Table of Contents =-
	i. License Information
	ii. Why?
	1. The Basics
		1.1 Diagram Of Numpad/AMC Subcommand Names
		1.2 Example Of AMC Steps
	2. Basic AMCs
		2.1 Attack / Follow ("19")
		2.2 Set Mode: Passive ("24") / Aggressive ("26")
		2.3 Friend Support ("4-")
			2.3.1 Friend Add ("48")
			2.3.2 Friend Remove ("42")
			2.3.3 Save Friend List ("46")
			2.3.4 Load Friend List ("44")
		2.4 Kite Monster ("17")
	3. Quickdial AMCs
		2.1 Attack / Follow ("9")
		2.2 Friend Support ("4")
		2.3 Kite ("17")
	4. Adding Your Own
		4.1 Commands
		4.2 Subparsers


---===---
i. License Information
---===---

This file is part of RampageAI.

RampageAI is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

RampageAI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with RampageAI; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

---===---
ii. Why?
---===---

I had originally written RampageAI to be as simple and configurable as possible.
However, as time went on it became increasingly complex, so I decided that I
should add another layer of commandability. I've always been against use of 3rd
party programs and external .dll usage with homunculus AI scripts, so this is
my alternative.

Advanced Movement Commands (AMCs) have been designed in a manner so they can
be disabled with no major impact to the script as a whole, such that users
who are still getting used to the script (or just simply don't want AMCs)
do not have to deal with them.

---===---
1. The Basics
---===---

First and foremost, none of this will mean anything unless AMCs are enabled in
Config.lua. Go ahead and change the Config.lua option EnableAMC to "true" to
enable them.

AMCs work by taking a sequence of movement commands. There are 9 possible
tiles (3x3 square) with which to sequence an AMC. AMC subcommands will be
referred to by their numpad counterparts, as shown by the following diagram:

===
Diagram 1.1 - Diagram Of Numpad/AMC Subcommand Names
===
		789
		456
		123
===

Please note that AMCs can target any player or monster. Targetting
any "actor" is the same as targetting yourself, with each actor's AMC
command "pad" centered on them.

With the exception of AMC subcommand 5, all may be used in any combination to
generate the AMC sequence. AMC subcommand 5 is used to tell the script that
the sequence is ready to be processed, and will clear the sequence. Instructing
the homunculus to attack the target (via alt-right click twice) will also act as
the 5 subcommand.

For example, in order to perform AMC "2628", one would follow these steps:

===
Diagram 1.2 - Example of AMC steps
===

(. is a blank tile, O is the owner (you), x is the alt+right click, o is a player,
	and T is the AMC target)

Step 1 (AMC subcommand "2")
.......o...
..T........
..x..O.....
...........
.........o.
..o........

Step 2 (AMC subcommand "6")
.......o...
..Tx.......
.....O.....
...........
.........o.
..o........

Step 3 (AMC subcommand "2")
.......o...
..T........
..x..O.....
...........
.........o.
..o........

Step 4 (AMC subcommand "8")
..x....o...
..T........
.....O.....
...........
.........o.
..o........

Step 5 (AMC subcommand "5", aka "execute")
.......o...
..x........
.....O.....
...........
.........o.
..o........

===

If a period of milliseconds equal to the Config.lua option "AMCResetTime" has
elapsed between any of the above steps, the sequence would be reset and as
such would result in an unexpected behavior (if any).

---===---
2. Basic AMCs
---===---

These are the Advanced Movement Commands that are set by default inside of AMCs.lua

---
2.1 Attack / Follow ("19")
---

The AMC for this is "19". If the target can be attacked the homunculus will
attack and/or use skills against them, but if they cannot be the homunculus
will simply follow them everywhere.

---
2.2 Set mode: Aggressive ("26") / Passive ("24")
---

This AMC is only valid when the target is yourself as the homunculus owner.
It begins with "2", and if it is followed by "4" then it forces your
homunculus to become passive. If it is followed instead by a "6" then
it tells your homunculus to be aggressive.

---
2.3 Friend Support ("4-")
---

This is an AMC "parser", which takes more commands in order to perform a more full action.

- 2.3.1 - Friend Add ("48") will add a user to the friend list permanently.
- 2.3.2 - Friend Remove ("42") will remove a user from the friend list permanently.
- 2.3.3 - Save Friend List ("46") will save the current friend list into
		"RagnarokOnline\AI\USER_AI\Conf\Friends.lua"
- 2.3.4 - Load Friend List ("44") will load the friend list from the above filename.

---
2.4 Kite Monster ("17")
---

This AMC causes the homunculus to go into "kite-tank" mode for the target. Kite-mode
works by keeping a distance from the target monster and the homunculus as long as
the monster is targetting the homunculus. If the monster is not targetting the homu,
then the homu will go and attack the monster until it does.

If you target your alchemist with this, it will toggle the ability to allow the
homunculus to aggro to kitable monsters even while in passive mode.

---===---
3. Quickdial AMCs
---===---

Quickdial AMcs are a subset of regular AMCs. If you have Quickdial AMcs enabled,
then you will only need to "press" one number on the keypad. After pressing the first
number, the command will immediately activate. This reduces the number of possible
commands to 9. With quickdial AMCs you can still target different monsters or people, but
much faster.

---
3.1 Attack / Follow ("9")
---

This quickdial AMC acts the exact same as the basic AMC specified in section 2.1.

---
3.2 Friend Support ("4")
---

This quickdial AMC performs differently based on who it is targetting:

 - When it is targetting you as the alchemist, it will save the friend list
	(Same as section 2.3.3).
 - When it is targetting anything else, it will toggle them as a friend.
	(If they are not already a friend, it will do 2.3.1. Otherwise, section 2.3.2)

---
3.3 Kite ("7")
---

This quickdial AMC performs the same action as the basic AMC in section 2.4.

---===---
4. Adding Your Own
---===---

---
4.1 Commands
---

To add your own commands, simply call the function AMC_AddCommand with 2
arguments: the full command (excluding "5"), and the function to call.
The function called will be passed 1 argument, which will be the AMC target.

---
4.2 Subparsers
---

To add a subparser, call the function AMC_AddParser with 2 arguments:
the beginning of the command, and the function to call. Subparsers are
only checked if there are no commands that match the AMC sequence exactly.
Parsers will be passed any sequence that begins a certain way. Parser
functions are also passed 2 arguments: the target, and the section of the
AMC sequence that has not been parsed already.

For example, if a subparser was set up to catch "25", and the user entered
"2564", the subparser function would be called and passed the target and "64".
